
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;

//hashCode
//HashMap
class Animal{
    String id;
    String name;
    
    public Animal(String id, String name) {
        this.id = id;
        this.name = name;
    }

    @Override
    public String toString() {
        return "Animal{" + "id=" + id + ", name=" + name + '}';
    }

    
}
public class HashMapTest {
    public static void main(String[] args){
        HashMap<String, Animal> hashMap=new HashMap<String, Animal>();
        for(int i=0;i<10;i++){
            hashMap.put("animal"+i, new Animal("animal"+i,"animal"+i));
        }
        System.out.println(hashMap.put("animal"+0, new Animal("animal"+0,"test")));
        System.out.println(hashMap.containsKey("animal"+0));
        for(Map.Entry<String,Animal> item: hashMap.entrySet()){
            String key=item.getKey();
            Animal animal=item.getValue();
            System.out.println("key="+key+"  value="+animal);
        }
    }
}
